<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="dao.Query_one"%>
<%@page import="dao.Entity.Reservation"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="shortcut icon"  href="image/icon6.ico" type="image/x-icon" /> 
        <link href="css/allcss.css" rel="stylesheet" type="text/css"/>
        <script src="./script/jquery.js" type="text/javascript"></script>
        <title>Update</title>
    </head>
    <body>
        <div id="aside">
            <img id="icon" src="./image/icon6.png">
            <div id="p1">管理员界面</div>    
        </div>
        <div id="updateStatus_main">
            <%
                try {
                    int n = -1;
                    n = Integer.parseInt(request.getParameter("number"));
                    Reservation res = Query_one.getResult(n);
                    if (res != null) {
                        out.print("<div id=inf>详细信息</div>");
                        out.print("<div id='number1'  value='" + res.AppointmentNumber + "'>预约号：" + res.AppointmentNumber + "</div>");
                        out.print("<div>学生号：" + res.StudentAccount + "</div>");
                        out.print("<div>地点号：" + res.PlaceTimeNumber + "</div>");
                        out.print("<div>地点：" + res.PlacePosition + "</div>");
                        out.print("<div>预约时间：" + res.AppointmentTime + "</div>");
                        out.print("<div>活动类型：" + res.ActivityType + "</div>");
                    }
                } catch (Exception e) {
                }
            %>
            <div>---------------------------------------</div>
            <button id="pass">通过</button>
            <button id="unpass">不通过</button>
            <button id="return">返回</button>
        </div>
        <script>
            $("#pass").click(
                    function () {
                        $.get("./Servlet/updateReservationStatusServlet?appointmentNumber=" + $("#number1").attr("value") + "&appointmentCheckStatus=1", function (data, status) {
                            if (data !== "-1") {
                                alert("成功");
                            } else {
                                alert("失败");
                            }
                        }
                        );
                    }
            );
            $("#unpass").click(
                    function () {
                        $.get("./Servlet/updateReservationStatusServlet?appointmentNumber=" + $("#number1").attr("value") + "&appointmentCheckStatus=0", function (data, status) {
                            if (data !== "-1") {
                                alert("成功");
                            } else {
                                alert("失败");
                            }
                        }
                        );
                    }
            );
            $("#return").click(
                    function () {
                        window.location.href = "manage.jsp"; //This is a possibility
                    }
            );
        </script>            
    </body>
</html>


